package midend.IR_Value;

import midend.IR_Type.IR_Const;
import midend.IR_Type.IR_Type;

//主要 是区分和局部变量 里面最前面的那个 @ % 的
public class IR_Global_Value extends IR_Value{
    private String Global_Identity;
    private static int counter = 0;
    private int number;
    private IR_Type Global_Type;

    public String get_Global_Identity() {
        return Global_Identity;
    }

    public IR_Global_Value(String global_Value, IR_Type global_Type) {
        Global_Identity = global_Value;
        this.number = counter++;
        Global_Type = global_Type;
    }

    public IR_Type get_Global_Type() {
        return Global_Type;
    }

    @Override
    public String get_ValueName() {
        return "@" + Global_Identity+this.number;
    }

    @Override
    public IR_Type get_Type() {
        return Global_Type;
    }
    @Override
    public int get_Const_Type() {
        return IR_Const.IR_GlobalVariable;
    }

    @Override
    public String toString() {
        return "IR_Global_Value:"+get_ValueName() + "   Global_Type:"+Global_Type;
    }
}
